package com.example.setalarm.utils;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Paint;

public class Utils {

	public static Bitmap makeIcon(float radius, Bitmap bmp, int color) {
		Bitmap bm = Bitmap.createBitmap((int) radius * 2, (int) radius * 2,
				Config.ARGB_4444);
		Canvas c = new Canvas(bm);
		Paint p = setPaint();
		p.setColor(color);

		c.drawCircle(bm.getWidth() / 2, bm.getHeight() / 2, radius, p);
		c.drawBitmap(bmp, (bm.getWidth() - bmp.getWidth()) / 2,
				(bm.getHeight() - bmp.getHeight()) / 2, p);

		return bm;
	}

	public static Paint setPaint() {
		Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
		p.setAntiAlias(true);
		p.setFilterBitmap(true);
		p.setDither(true);

		return p;
	}
}
